import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    component: () => import('@/views/Home/Home.vue'),
    redirect: '/home',
  },
  {
    path: '/home',
    component: () => import('@/views/Home/Home.vue'),
    redirect: '/home/goods-list',
    children: [
      {
        path: 'goods-list',
        component: () => import('@/views/Home/components/GoodsList.vue')
      },
      {
        path: 'enterprise',
        component: () => import('@/views/Home/components/Enterprise.vue')
      },
      {
        path: 'evaluate',
        component: () => import('@/views/Home/components/Evaluate.vue')
      }
    ]
  },
  {
    path: '/goods-detail',
    component: () => import('@/views/GoodsDetail/GoodsDetail.vue')
  },
  {
    path: '*',
    component: () => import('@/views/Error404/Error404.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
